/**
 *
 */
package de.cbf.cam.dsa.services.impl.rcp_provider.extension.interfaces;

import java.util.HashMap;
import java.util.Map;

/**
 * @author salter
 *
 */
public abstract class AbstractParameteredPersister implements IRCPPersisterParametered {
	protected Map<String, Object> loadParameters;
	protected Map<String, Object> saveParameters;

	protected String name;

	public AbstractParameteredPersister() {
		super();
		loadParameters = new HashMap<String, Object>();
		saveParameters = new HashMap<String, Object>();
	}

	@Override
	public String toString() {
		return name;
	}

	@Override
	public Map<String, Object> getLoadParameters() {
		return new HashMap<String, Object>(loadParameters);
	}

	@Override
	public Map<String, Object> getSaveParameters() {
		return new HashMap<String, Object>(saveParameters);
	}
	@Override
	public void setLoadParameters(Map<String, Object> loadParameters) {
		this.loadParameters.clear();
		if(loadParameters != null){
			this.loadParameters.putAll(loadParameters);
		}
	}

	@Override
	public void setSaveParameters(Map<String, Object> saveParameters) {
		this.saveParameters.clear();
		if(saveParameters != null){
			this.saveParameters.putAll(saveParameters);
		}
	}

	@Override
	public String getName() {
		return name;
	}

	@Override
	public void setName(String name) {
		this.name = name;
	}

}
